<template>
  <div class="main">
    <el-container class="main-content">
      <el-aside :width="isFold ? '48px' : '210px'">
        <MainMenu :is-fold="isFold" />
      </el-aside>
      <el-container>
        <el-header height="50px">
          <MainHeader @fold-change="handleFoldChange" />
        </el-header>
        <el-main>
          <RouterView></RouterView>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
// 模块引入
import { ref } from 'vue'
import MainMenu from '@/components/page/main/nav-menu/menu.vue'
import MainHeader from '@/components/page/main/nva-header/header.vue'
defineOptions({
  // 组件名称
  name: 'JC_Main',
  // 继承透传，是否继承没在子组件声明的父组件的属性
  inheritAttrs: true
})
const isFold = ref<boolean>(false)
const handleFoldChange = (isCollapse: boolean) => {
  isFold.value = isCollapse
}
</script>

<style scoped lang="scss">
.main {
  height: 100%;
}
.main-content {
  height: 100%;

  .el-aside {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 200px;
    text-align: left;
    cursor: pointer;
    background-color: #001529;
    transition: width 0.5s ease-out;
    scrollbar-width: none;
    -ms-overflow-style: none;
    &::-webkit-scrollbar {
      display: none;
    }
  }

  .el-header {
    padding: 0 20px;
  }

  .el-main {
    padding: 20px;
    background-color: #f0f2f5;
  }
}
</style>
